package com.example.medicine.View;

import com.example.medicine.Bean.dilixinxi;
import com.example.medicine.Mapper.dlxxMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.subject.support.DelegatingSubject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@Slf4j
@Controller
public class DlxxView {
    @Autowired
    private dlxxMapper dlxxMapper;
    Subject subject = SecurityUtils.getSubject();
    /**
     * 展示地理信息列表页面
     */
    @RequiresPermissions("地理信息库")
    @RequestMapping("/dlxx")
    public String dlxxShow(){
        log.info("地理信息列表页面");
        return "pages/dlxx/list";
    }
    @RequiresPermissions("地理信息库")
    @RequestMapping("/dlxx/create")
    public String dlxxCreateShow(){
        log.info("地理信息创建页面");
        return "pages/dlxx/create";
    }
    /**
     * Dlxx编辑展示页面
     */
    @RequiresPermissions("地理信息库")
    @RequestMapping("/dlxx/edit/{id}")
    public String getDlxxById(@PathVariable int id, Model model){
        log.info("地理信息编辑页面");
        dilixinxi dilixinxi= dlxxMapper.getById(id);
        dilixinxi.setId(id);
        model.addAttribute("dlxx", dilixinxi);
        return "pages/dlxx/edit";
    }
}
